<!-- 	<template>
		<view>
			<view class="confirmtop" @tap="goPathList">
				<view class="cfimgv">
					<image class="cfimg" src="/static/tabBar/my_1.png" mode=""></image>
				</view>
				<view class="rightconfir">
					<view class="petop">
						<view class="petr">
							<view class="">
								收货人:
							</view>
							<view class="">
								{{page.name}}
							</view>

						</view>
						<view class="">
							{{page.tel}}
						</view>
					</view>
					<view class="address">
						<view>
							收货地址:
						</view>
						<view>
							{{page.province}}{{page.city}}{{page.district}}{{page.address}}
						</view>
					</view>
				</view>

			</view>
			<mylines></mylines>
			
			<view class="" v-if="goodsList[0]">
				<view class="order-content">
				<view class="" v-for="(it,index) in goodsList" :key="index">
					<view class="buy">
						<view class="buyiv">
							<image class="buyimg" src="/static/tabBar/my_1.png" mode=""></image>
						</view>
						{{it.rulue}}专农营惠店
					</view>
					<view class="all">
						<view class="">
							<image class="leftimg" :src="it.imgUrl" mode=""></image>
						</view>
						<view class="content">
							<view class="">
								{{ it.name}}
							</view>
							<view class="color">
								{{it.rulue}}
							</view>
							<view class="free">
								7天无理由
							</view>
						</view>
						<view class="pnall">
							<view class="prinum">
								<view class="pri">
									¥{{it.pprice}}
								</view>
								<view class="num">
									*{{it.num}}
								</view>
							</view>
						</view>
					</view>
				</view>
			</view>
			</view>
			
			<view class="confirmbut">
				<view class="firmbuttop">
					运费
					<view class="">
						¥0.00
					</view>
				</view>
				<view class="firmbuttton">
					<textarea class="areatext" name="" id="" cols="30" rows="10" placeholder="给卖家留言,140字以内"></textarea>
				</view>

			</view>
			<view class="firmbutbot">
				<view class="botto">
					<view class="upmitc">
						共{{totalCount.num}}件商品 小计:
					</view>
					<view class="upmitc f-active-color">
						¥{{totalCount.pprice}}
					</view>
					<view class="upmit" @tap="goPayment">
						提交订单
					</view>
				</view>
			</view>
		</view>
	</template>

	<script>
		import mylines from '@/components/common/Lines.vue'
		import $http from '@/common/api/request.js'
		import {
			mapGetters,
			mapState,
			mapMutations
		} from 'vuex'
		export default {
			data() {
				return {
					orderlist: [],
					page: {},
					item: []
				}
			},
			components: {
				mylines
			},
			methods: {
				...mapMutations(['__initAddressList', 'initOrder']),
				goPathList() {
					uni.navigateTo({
						url: '/pages/my-path-list/my-path-list?type=selectedPath'
					})
				},
				goPayment() {
					if (!this.page.name) {
						uni.showToast({
							title: "请选择收货地址",
							icon: "none",
							mask: true
						})
						return
					}

					//生成订单数据
					$http.request({
						url: "/addOrder",
						method: "POST",
						header: {
							token: true
						},
						data: {
							arr: this.goodsList
						}
					}).then((res) => {
						this.initOrder(res[0].order_id);
						uni.navigateTo({
							url: `/pages/payement/payement?details=${JSON.stringify({
								pprice:this.totalCount.pprice,
								uuid:this.goodsList[0].uuid,
								goodslist:this.goodsList
							})}`
						})
					}).catch(() => {
						uni.showToast({
							title: "订单接口失败",
							icon: "none",
							mask: true
						})
					})
				},
				
				
			},
			computed: {
				...mapState({
					list: state => state.cart.list,
				}),
				...mapGetters(['defaultPath', 'totalCount']),

				goodsList() {
					return this.item.map(id => {
						return this.list.find(v => v.id == id)
					})
				}
			},
			onLoad(e) {
				this.item = JSON.parse(e.details);
				$http.request({
					url: "/selectAddress",
					method: "POST",
					header: {
						token: true
					}
				}).then((res) => {
					this.__initAddressList(res)
					if (this.defaultPath.length) {
						this.page = this.defaultPath[0]
					}
					uni.$on("selectPathItem", (res) => {
						this.page = res
					})
				}).catch(() => {
					uni.showToast({
						title: "请求地址接口失败",
						icon: "none",
						mask: true
					})
				})
			},
			onUnload() {
				uni.$off('selectPathItem', () => {
					console.log("移除selectPathItem");
				})
			},
			onShow() {

			}
		}
	</script>

	<style lang="scss">
		.order-content {
			.buy {
				padding: 10rpx 30rpx;
				color: #e0584b;
				display: flex;
				font-size: 28rpx;

				.buyiv {
					margin-top: 5rpx;

					.buyimg {
						width: 30rpx;
						height: 30rpx;
					}
				}

			}

			.all {
				display: flex;
				background-color: #f6f6f6;
				justify-content: space-between;

				.leftimg {
					width: 180rpx;
					height: 180rpx;
				}

				.content {
					width: 450rpx;

					.color {
						color: #cccccc;
					}

					.free {
						color: #42B7FB;
					}
				}

				.pnall {
					.prinum {

						padding: 10rpx 20rpx;

						.pri {
							font-weight: 800;
						}

						.num {
							display: flex;
							justify-content: end;
							color: #cecece;
						}
					}
				}

			}

		}

		.confirmbut {
			.firmbuttop {
				padding: 20rpx;
				display: flex;
				justify-content: space-between;
			}

			.firmbuttton {
				.areatext {
					width: 100%;
					height: 150rpx;
					border: 1rpx solid #282c35;
				}
			}


		}

		.firmbutbot {

			width: 100%;
			// height: 90rpx;
			position: absolute;
			right: 0;
			bottom: 0;
			// display: flex;
			//  justify-content: end;
			// align-items: center;
			
			background-color: #f6f6f6;

			.botto {
				display: flex;
				
				align-items: center;
				padding-left: 220rpx;
				// position: absolute;
				// right: 0;
				// bottom: 0;
				.upmitc {
					padding: 10rpx 10rpx;
				}

				.upmit {
					padding: 10rpx 20rpx;
					background-color: #f21e0c;
					border: 1rpx solid #282c35;
					border-radius: 30rpx;
				}
			}
		}

		.confirmtop {
			display: flex;

			.cfimgv {
				padding: 10rpx 10rpx;
				margin-top: 20rpx;
				width: 5%;

				.cfimg {
					width: 50rpx;
					height: 50rpx;
				}
			}


			.rightconfir {
				width: 95%;
				padding: 20rpx 10rpx;

				.petop {
					display: flex;
					justify-content: space-between;

					.petr {
						display: flex;
					}
				}

				.address {
					display: flex;
					font-size: 25rpx;


				}
			}
		}
	</style> -->